Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Installation already appears to support a couple modes:
ESBUILD_BIN_PATH_FOR_TESTS
which symlinks anesbuild
binary intonode_modules
installBinaryFromPackage
which either installs from a local cache or downloads the binary fromnpm
(directly or vianpm
)However, this doesn't match our needs exactly. In particular, we run
yarn install
in--offline
mode inside a micro VM without network access. Thus, we need a way to tell theesbuild
installer about a binary that we've already downloaded. Since we need thenode_modules
to be standalone,ESBUILD_BIN_PATH_FOR_TESTS
doesn't work since it creates a symlink.We handle a similar issue with
node-sass
by usingnpm_config_sass_binary_cache
. However, the local caching logic inesbuild
is a little more involved and I'm loathe to attempt replicating it our end (especially since we support bothdarwin
andlinux
-- see the hack mentioned later).So, there are two potential solutions:
ESBUILD_CACHE_PATH
which overrides the cache directlyESBUILD_BIN_PATH
which acts just likeESBUILD_BIN_PATH_FOR_TESTS
but copies the file insteadI decided on the latter since that resolves the problem directly (although I do need to test this change with our build system... opening the PR early to see if there's any appetite for this tweak).
For completeness, my current hack is:
(within the
yarn install
Bazel action)